package com.example.homework7;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import androidx.annotation.Nullable;

public class MusicService extends Service {
    public MusicService() {
    }
    private MusicHelper musicHelper = null;

    @Override
    public void onCreate() {
        super.onCreate();
        musicHelper = new MusicHelper(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        musicHelper.destroy();
        musicHelper=null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        musicHelper.play();
        return super.onStartCommand(intent, flags, startId);
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}